package day03;

public class OperDemo33 {
    public static void main(String[] args) {
        //3)逻辑运算符:&&（与）、||（且）、!(取反)
        int a = 5, b = 10, c = 5;
                //演示&&   见false为false
        boolean b1 = b>=a && b<c;
        System.out.println(b1);         //false
        System.out.println(b>=a && b<c);//false
        System.out.println(b<=c && b>a);//false
        System.out.println(b!=c && a<b);//ture

        System.out.println("--------------------------");

        int age = 40;
        //判断年龄是否在18-60之间,在为ture，不在为false
        System.out.println(age>=18 && age<=60);
        int score = 86;
        //判断分数是否在60-100之间,在为ture，不在为false
        System.out.println(score>=60 && score<=100);




        System.out.println("--------------------------");


                //演示||       见ture为true
                //int a = 5, b = 10, c = 5;
        System.out.println(b>=a || b<c);//ture
        System.out.println(b<=c || b>a);//ture
        System.out.println(b!=c || a<b);//ture
        System.out.println(b>=a || b<=c);//ture
        System.out.println(a==b || b<c);//false

        boolean b2 = !(a<b);
        System.out.println(b2);//false
        System.out.println(!(a>b));//true


        System.out.println("--------------------------");


                //演示&&和||的短路
                //int a = 5, b = 10, c = 5;
        boolean b3 = a>b && c++>2;
        System.out.println(b3); //false
        System.out.println(c);  //5

        boolean b4 = a<b || c++>2;
        System.out.println(b4); //true
        System.out.println(c);  //5

    }
}
